﻿@model IEnumerable<StudentPortal.Models.webpages_Group>

@{
    ViewBag.Title = "Nhóm người dùng";
	Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="row-fluid">
	<div class="span12">

<p>
    @Html.ActionLink("Thêm", "Create", new { }, new { @class = "btn green" })
</p>
@(Html.Kendo().Grid<StudentPortal.Models.webpages_Group>()
	.Name("webpages_Group")
	.Columns(columns =>
	{
			columns.Bound(model => model.GroupName);
		        columns.Command(command => {command.Custom("Sửa").Click("Edit"); command.Custom("Xóa").Click("Delete");});
	})
	.Groupable()
	.Pageable()
	.Sortable()
	.DataSource(
		dataSource => dataSource.Ajax()
			.Read(read => read.Action("Read", "Group"))
	)
)

	</div>
</div>
<script type="text/javascript">
	function Edit(e) {
		e.preventDefault();
		var dataItem = this.dataItem($(e.currentTarget).closest('tr'));
		location.href='@Url.Action("Edit","Group")/'+dataItem.GroupId;
	}
	function Delete(e) {
		e.preventDefault();
		var dataItem = this.dataItem($(e.currentTarget).closest('tr'));
		location.href = '@Url.Action("Delete","Group")/' + dataItem.GroupId;
	}
</script>
